#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int MAXN = 410;
const int mod = 1e9+7;

ll mat[MAXN][MAXN<<1];
int n;

ll qp(ll x,int t){ll res = 1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

void Guess(){
	for(int i = 1;i <= n;i++){
		int p = i;
		for(int j = i+1;j <= n;j++) if(mat[j][i] > mat[p][i]) p = j;
		if(p != i) for(int k = i;k <= n<<1;k++) swap(mat[i][k],mat[p][k]);
		if(!mat[i][i]) {puts("No Solution");exit(0);}
		ll inv = qp(mat[i][i],mod-2);
		for(int j = 1;j <= n;j++){
			if(i == j) continue; ll r = inv * mat[j][i] % mod;
			for(int k = i;k <= n<<1;k++) mat[j][k] = ((mat[j][k] - r * mat[i][k] % mod) % mod + mod) % mod;
		}
		for(int k = i;k <= n<<1;k++) mat[i][k] = mat[i][k] * inv % mod;
	}
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;for(int i = 1;i <= n;i++) {for(int j = 1;j <= n;j++) mat[i][j] = in; mat[i][i+n] = 1;}
	Guess();
	for(int i = 1;i <= n;i++) for(int j = n+1;j <= n<<1;j++) printf("%lld%c",mat[i][j]," \n"[j==n<<1]);
	return 0;
}

